import {LOGOUT, SET_TOKEN, SET_USERNAME} from "../constant";

export interface ActionConfig<T = any> {
    type: string
    data?: T | null
}

/* 创建一个设置token的Reducer */
export const setTokenAction = (token: string | null): ActionConfig<string> => ({data: token, type: SET_TOKEN})
/* 修改用户名 */
export const setUsernameAction = (username: string | null): ActionConfig<string> => ({
    data: username,
    type: SET_USERNAME
})
/* 退出登录 */
export const logoutAction = (): ActionConfig => ({type: LOGOUT})

